<?php
  // Si des infos ont été envoyées à traver un <form>, se connecter à la bdd
  // La connection à la BDD doit se faire avant tout le reste, de même que le header.
if(isset($_POST))
  {
    mysql_connect('localhost', 'root', 'pass');
    mysql_select_db('openpiscine');
  }
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
  <head>
    <meta http-equiv="Content-Type" content="text/html charset=utf8" />
    <meta name="author" content="stern_d, merbou_l, diallo_l" />
    <meta name="description" content="Rattrapage HTML, CSS, PHP" />
    <meta name="keywords" content="tp, rattrapage, html, webacademie, css, php, sql, piscine, openpiscine" />
    <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" />
    <title>After-Piscine</title>
  </head>

<body>

<?php include('headerinc.template'); ?>
    
<!--DEBUT CONTENT-->
	<div class="content">
		<div class="wrapper">
<?php
	
	if($_POST!=NULL)
	{
		if(($_POST['login'] == NULL) or ($_POST['login'] == 'Login'))
		{
		include('../txt/registre.html');
		echo '<p id="error" style="color:red;">error login</p>';
?>
	<div class="formulaire">            
        <form id="formulaire" name="formulaire" method="post" action="registre.php">
        <p><strong>LOGIN</strong><br />
        <input type="text" name="login" value="Login" onclick="this.value='';"/></p>
        <p><input name="submit" type="image" value="GOFORM" src="../img/goform.jpg" alt="go" /></p>
        </form>
	</div>
<?php
		}
		else
		{
		include('../txt/registre.html');
		echo '<p id="success" style="color:#b1d438;">Un mail a été envoyé a ' . $_POST['login'] . '@epitech.eu </p>';
		}
	}
	else
	{
	include('../txt/registre.html');	
?>
<!-- Form -->		
	<div class="formulaire">
        <form id="formulaire" name="formulaire" method="post" action="registre.php">
        <p><strong>LOGIN</strong><br />
        <input type="text" name="login" value="Login" onclick="this.value='';"/></p>
        <p><input name="submit" type="image" value="GOFORM" src="../img/goform.jpg" alt="go" /></p>
        </form>
	</div>
<?php
}
?>
<div class="clear"></div>
	</div>
	</div>

	
<!--FIN CONTENT-->
<?php include('footer.template'); ?>

</html>
